﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Grain.Crm.DataMigrator.CrmServices;
using Grain.Crm.DataMigrator.Imports.EntityImports;

namespace Grain.Crm.DataMigrator.Imports
{
    public class ImportFactory
    {
        public static ImportBase Create(CrmService service, WhoAmIResponse whoAmIResponse, ImportPayload payload)
        {
            if (payload.EntityName == EntityName.contact.ToString())
                return new ContactImport(service, whoAmIResponse, payload);

            if (payload.EntityName == EntityName.new_curriculumvitae.ToString())
                return new CvImport(service, whoAmIResponse, payload);

            if (payload.EntityName == EntityName.new_contactlanguage.ToString())
                return new ContactLanguageImport(service, whoAmIResponse, payload);
            
            if (payload.EntityName == EntityName.new_contactskill.ToString())
                return new ContactSkillImport(service, whoAmIResponse, payload);

            if (payload.EntityName == EntityName.new_professionalexperience.ToString())
                return new ProfessionalExperienceImport(service, whoAmIResponse, payload);

            if (payload.EntityName == EntityName.new_contactprojects.ToString())
                return new ContactProjectsImport(service, whoAmIResponse, payload);

            if (payload.EntityName == EntityName.new_contactcourses.ToString())
                return new ContactCoursesImport(service, whoAmIResponse, payload);

            if (payload.EntityName == EntityName.new_education.ToString())
                return new EducationImport(service, whoAmIResponse, payload);


            throw new InvalidOperationException(
                "ImportFactory.Create(): Import factory creation not supported for entity:" + payload.EntityName);

        }
    }
}
